<?php
$this->Html->addCrumb('Ads main', '/admin/ads/main');
$this->Html->addCrumb('Ads', '/admin/ads');
$this->Html->addCrumb('Add');
?>
<?php 
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#AdAdminAddForm").TWS_Form( {
          validate : {
          rules : {
            AdCompanyId : {required : true, help : "This is the company that the ad is tied to."},
            AdSinglePhoto : {help : "<strong>Yes</strong> - Only one photo can be associated with the ad. This will be a larger photo.<br/><br/><strong>Yes</strong> - Multiple photos can be associated with the ad. These will be smaller photos."},
            AdDescription: {required : true, help : "This is a description of the ad. It will help to identify the ad."},
            AdStartDate : {required: true, date : true, help : "This is the start date when the ad will begin"},
            AdEndDate : {required: true, date : true, help : "This is the end date when the ad will stop running"},
            AdYoutubeUrl : {url:true}
          }
          }});
        });
       ';
$this->Html->scriptEnd();
?>
<h1>Add Ad</h1>

<?php echo '<div id="actionLink">'.$this->Html->link('Back to list of Ads',array('action'=>'index','admin'=>true)).'</div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('Ad',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));

echo $this->TWSForm->input('company_id', array('name'=>'AdCompanyId','type'=>'select', 'label'=>'<span class="required">*</span>Company','options'=>$options));
echo $this->TWSForm->input('description', array('rows'=>'5','cols'=>'60','name'=>'AdDescription', 'label'=>'<span class="required">*</span>Description'));

echo $this->TWSForm->input('single_photo', array('name'=>'AdSinglePhoto', 'type'=>'select', 'label'=>'Single photo', 'options'=>$singleOptions));

echo $this->TWSForm->input('youtube_url', array('type'=>'text', 'name'=>'AdYoutubeUrl', 'label'=>'YouTube url', 'size'=>'70'));

echo $this->TWSForm->input('start_date', array('type'=>'text', 'rel'=>'date','name'=>'AdStartDate', 'label'=>'<span class="required">*</span>Start Date'));
echo $this->TWSForm->input('end_date', array('type'=>'text', 'rel'=>'date','name'=>'AdEndDate', 'label'=>'<span class="required">*</span>End Date'));
echo $this->TWSForm->end( array("label"=>"Add", "class"=>"button"));


?>